题目链接
https://leetcode.com/problems/maximum-depth-of-binary-tree/
题目原文
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
题目翻译
给定一个二叉树,求其最大深度。
最大深度指的是,从根节点到最远的叶子节点的最长路径的节点个数。
思路方法
思路一
深度优先搜索(DFS),递归求解。
代码
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
#